home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / latex209 / contrib / harvard / jphysicsB.bst < prev    next >
Text File  |  1994-06-16  |  24KB  |  1,306 lines

  1. % BibTeX standard bibliography style `jphysicsB' (one of the harvard family)
  2.     % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  3.     % Copyright (C) 1991, all rights reserved.
  4.     % Copying of this file is authorized only if either
  5.     % (1) you make absolutely no changes to your copy, including name, or
  6.     % (2) if you do make changes, you name it something other than
  7.     % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, abbrv.bst, agsm.bst,
  8.         % dcu.bst, kluwer.bst or jphysicsB.bst.
  9.     % This restriction helps ensure that all standard styles are identical.
  10.     % The file harvard.tex has the documentation for this style.
  11.  
  12. % ACKNOWLEDGEMENT:
  13. %   This document is a modified version of alpha.bst to which it owes much of
  14. %   its functionality.
  15.  
  16. % AUTHOR
  17. %   Peter Williams, Key Centre for Design Quality, Sydney University
  18. %   e-mail: peterw@archsci.arch.su.oz.au
  19.  
  20. ENTRY
  21.   { address
  22.     author
  23.     booktitle
  24.     chapter
  25.     edition
  26.     editor
  27.     howpublished
  28.     institution
  29.     journal
  30.     key
  31.     month
  32.     note
  33.     number
  34.     organization
  35.     pages
  36.     publisher
  37.     school
  38.     series
  39.     title
  40.     type
  41.     volume
  42.     year
  43.   }
  44.   { field.used etal.allowed etal.required} %%%XXX change
  45.   { extra.label sort.label list.year }
  46.  
  47. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  48.  
  49. FUNCTION {init.state.consts}
  50. { #0 'before.all :=
  51.   #1 'mid.sentence :=
  52.   #2 'after.sentence :=
  53.   #3 'after.block :=
  54. }
  55.  
  56. STRINGS { s t f }
  57.  
  58. FUNCTION {output.nonnull}
  59. { 's :=
  60.   output.state mid.sentence =
  61.     { " " * write$ }
  62.     { output.state after.block =
  63.     { add.period$ write$
  64.       newline$
  65.       "\newblock " write$
  66.     }
  67.     { output.state before.all =
  68.         'write$
  69.         { add.period$ " " * write$ }
  70.       if$
  71.     }
  72.       if$
  73.       mid.sentence 'output.state :=
  74.     }
  75.   if$
  76.   s
  77. }
  78.  
  79. FUNCTION {output}
  80. { duplicate$ empty$
  81.     'pop$
  82.     'output.nonnull
  83.   if$
  84. }
  85.  
  86. FUNCTION {output.check}
  87. { 't :=
  88.   duplicate$ empty$
  89.     { pop$ "empty " t * " in " * cite$ * warning$ }
  90.     'output.nonnull
  91.   if$
  92. }
  93.  
  94. FUNCTION {item.check}
  95. { 't :=
  96.   empty$
  97.     { "empty " t * " in " * cite$ * warning$ }
  98.     { skip$ }
  99.   if$
  100. }
  101.  
  102. FUNCTION {fin.entry}
  103. { add.period$
  104.   write$
  105.   newline$
  106. }
  107.  
  108. FUNCTION {new.block}
  109. { output.state before.all =
  110.     'skip$
  111.     { after.block 'output.state := }
  112.   if$
  113. }
  114.  
  115. FUNCTION {not}
  116. {   { #0 }
  117.     { #1 }
  118.   if$
  119. }
  120.  
  121. FUNCTION {and}
  122. {   'skip$
  123.     { pop$ #0 }
  124.   if$
  125. }
  126.  
  127. FUNCTION {or}
  128. {   { pop$ #1 }
  129.     'skip$
  130.   if$
  131. }
  132.  
  133. FUNCTION {field.or.null}
  134. { duplicate$ empty$
  135.     { pop$ "" }
  136.     'skip$
  137.   if$
  138. }
  139.  
  140. FUNCTION {emphasize}
  141. { duplicate$ empty$
  142.     { pop$ "" }
  143.     { "{\em " swap$ * "}" * }
  144.   if$
  145. }
  146.  
  147. FUNCTION {embolden}
  148. { duplicate$ empty$
  149.     { pop$ "" }
  150.     { "{\bf " swap$ * "}" * }
  151.   if$
  152. }
  153.  
  154. FUNCTION {quote}
  155. { duplicate$ empty$
  156.     { pop$ "" }
  157.     { "`" swap$ * "'" * }
  158.   if$
  159. }
  160.  
  161. INTEGERS { nameptr namesleft numnames }
  162.  
  163. FUNCTION {format.names}
  164. { 's :=
  165.   'f :=
  166.   #1 'nameptr :=
  167.   s num.names$ 'numnames :=
  168.   numnames 'namesleft :=
  169.     { namesleft #0 > }
  170.     { s nameptr f format.name$ 't :=
  171.       nameptr #1 >
  172.     { namesleft #1 >
  173.         { ", " * t * }
  174.         { t "others" =
  175.         { " et~al." * }
  176.         { " \harvardand\ " * t * }
  177.           if$
  178.         }
  179.       if$
  180.     }
  181.     't
  182.       if$
  183.       nameptr #1 + 'nameptr :=
  184.       namesleft #1 - 'namesleft :=
  185.     }
  186.   while$
  187. }
  188.  
  189. FUNCTION {format.authors}
  190. { author empty$
  191.     { "" }
  192.     { "{vv~}{ll}{, jj}{ f{~}}" author format.names }
  193.   if$
  194. }
  195.  
  196. FUNCTION {format.editors}
  197. { editor empty$
  198.     { "" }
  199.     { "{vv~}{ll}{, jj}{ f{~}}" editor format.names
  200.       editor num.names$ #1 >
  201.     { ", eds" * }
  202.     { ", ed." * }
  203.       if$
  204.     }
  205.   if$
  206. }
  207.  
  208. FUNCTION {format.editors.reverse}
  209. { editor empty$
  210.     { "" }
  211.     { "{f~}{vv~}{ll}{, jj}" editor format.names
  212.       editor num.names$ #1 >
  213.     { ", eds" * }
  214.     { ", ed." * }
  215.       if$
  216.     }
  217.   if$
  218. }
  219.  
  220. FUNCTION {format.title}
  221. { title empty$
  222.     { "" }
  223.     { title "t" change.case$ }
  224.   if$
  225. }
  226.  
  227. FUNCTION {n.dashify}
  228. { 't :=
  229.   ""
  230.     { t empty$ not }
  231.     { t #1 #1 substring$ "-" =
  232.     { t #1 #2 substring$ "--" = not
  233.         { "--" *
  234.           t #2 global.max$ substring$ 't :=
  235.         }
  236.         {   { t #1 #1 substring$ "-" = }
  237.         { "-" *
  238.           t #2 global.max$ substring$ 't :=
  239.         }
  240.           while$
  241.         }
  242.       if$
  243.     }
  244.     { t #1 #1 substring$ *
  245.       t #2 global.max$ substring$ 't :=
  246.     }
  247.       if$
  248.     }
  249.   while$
  250. }
  251.  
  252. FUNCTION {format.btitle}
  253. { title emphasize
  254. }
  255.  
  256. FUNCTION {tie.or.space.connect}
  257. { duplicate$ text.length$ #3 <
  258.     { "~" }
  259.     { " " }
  260.   if$
  261.   swap$ * *
  262. }
  263.  
  264. FUNCTION {either.or.check}
  265. { empty$
  266.     'pop$
  267.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  268.   if$
  269. }
  270.  
  271. FUNCTION {format.bvolume}
  272. { volume empty$
  273.     { "" }
  274.     { "Vol." volume tie.or.space.connect
  275.       series empty$
  276.     'skip$
  277.     { " of " * series emphasize * }
  278.       if$
  279.       "volume and number" number either.or.check
  280.     }
  281.   if$
  282. }
  283.  
  284. FUNCTION {format.number.series}
  285. { volume empty$
  286.     { number empty$
  287.     { series field.or.null }
  288.     { output.state mid.sentence =
  289.         { "number" }
  290.         { "Number" }
  291.       if$
  292.       number tie.or.space.connect
  293.       series empty$
  294.         { "there's a number but no series in " cite$ * warning$ }
  295.         { " {\em in} " * series quote * }
  296.       if$
  297.     }
  298.       if$
  299.     }
  300.     { "" }
  301.   if$
  302. }
  303.  
  304. FUNCTION {format.edition}
  305. { edition empty$
  306.     { "" }
  307.     { output.state mid.sentence =
  308.     { edition "l" change.case$ " edn" * }
  309.     { edition "t" change.case$ " edn" * }
  310.       if$
  311.     }
  312.   if$
  313. }
  314.  
  315. INTEGERS { multiresult }
  316.  
  317. FUNCTION {multi.page.check}
  318. { 't :=
  319.   #0 'multiresult :=
  320.     { multiresult not
  321.       t empty$ not
  322.       and
  323.     }
  324.     { t #1 #1 substring$
  325.       duplicate$ "-" =
  326.       swap$ duplicate$ "," =
  327.       swap$ "+" =
  328.       or or
  329.     { #1 'multiresult := }
  330.     { t #2 global.max$ substring$ 't := }
  331.       if$
  332.     }
  333.   while$
  334.   multiresult
  335. }
  336.  
  337. FUNCTION {format.pages}
  338. { pages empty$
  339.     { "" }
  340.     { pages multi.page.check
  341.     { "pp.~" pages n.dashify * }
  342.     { "p.~" pages * }
  343.       if$
  344.     }
  345.   if$
  346. }
  347.  
  348. FUNCTION {format.vol.num.pages}
  349. { volume embolden field.or.null
  350.   number empty$
  351.     'skip$
  352.     { "(" number * ")" * *
  353.       volume empty$
  354.     { "there's a number but no volume in " cite$ * warning$ }
  355.     'skip$
  356.       if$
  357.     }
  358.   if$
  359.   pages empty$
  360.     'skip$
  361.     { duplicate$ empty$
  362.     { pop$ format.pages }
  363.     { ",~" * pages n.dashify * }
  364.       if$
  365.     }
  366.   if$
  367. }
  368.  
  369. FUNCTION {format.chapter.pages}
  370. { chapter empty$
  371.     'format.pages
  372.     { type empty$
  373.     { "chapter" }
  374.     { type "l" change.case$ }
  375.       if$
  376.       chapter tie.or.space.connect
  377.       pages empty$
  378.     'skip$
  379.     { ", " * format.pages * }
  380.       if$
  381.     }
  382.   if$
  383. }
  384.  
  385. FUNCTION {format.in.ed.booktitle}
  386. { booktitle empty$
  387.     { "" }
  388.     { editor empty$
  389.     { "{\em in} " booktitle quote * }
  390.     { "{\em in} " format.editors.reverse * ", " * booktitle quote * }
  391.       if$
  392.     }
  393.   if$
  394. }
  395.  
  396. FUNCTION {empty.misc.check}
  397. { author empty$ title empty$ howpublished empty$
  398.   month empty$ year empty$ note empty$
  399.   and and and and and
  400.   key empty$ not and
  401.     { "all relevant fields are empty in " cite$ * warning$ }
  402.     'skip$
  403.   if$
  404. }
  405.  
  406. FUNCTION {format.thesis.type}
  407. { type empty$
  408.     'skip$
  409.     { pop$
  410.       type "t" change.case$
  411.     }
  412.   if$
  413. }
  414.  
  415. FUNCTION {format.tr.number}
  416. { type empty$
  417.     { "Technical Report" }
  418.     'type
  419.   if$
  420.   number empty$
  421.     { "t" change.case$ }
  422.     { number tie.or.space.connect }
  423.   if$
  424. }
  425.  
  426. FUNCTION {format.article.crossref}
  427. { key empty$
  428.     { journal empty$
  429.     { "need key or journal for " cite$ * " to crossref " * crossref *
  430.       warning$
  431.       ""
  432.     }
  433.     { "in {\em " journal * "\/} \cite{" * crossref * "}" *}
  434.       if$
  435.     }
  436.     { "{\em in} \citeasnoun{" crossref * "}" * }
  437.   if$
  438.  
  439. }
  440.  
  441. FUNCTION {format.book.crossref}
  442. { volume empty$
  443.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  444.       "in "
  445.     }
  446.     { "Vol." volume tie.or.space.connect
  447.       " of " *
  448.     }
  449.   if$
  450.   editor empty$
  451.   editor field.or.null author field.or.null =
  452.   or
  453.     { key empty$
  454.     { series empty$
  455.         { "need editor, key, or series for " cite$ * " to crossref " *
  456.           crossref * warning$
  457.           "" *
  458.         }
  459.         { "{\em " * series * "\/} \cite{" * crossref * "}" *}
  460.       if$
  461.     }
  462.     { " \citeasnoun{" * crossref * "}" * }
  463.       if$
  464.     }
  465.     { " \citeasnoun{" * crossref * "}" * }
  466.   if$
  467. }
  468.  
  469. FUNCTION {format.incoll.inproc.crossref}
  470. { editor empty$
  471.   editor field.or.null author field.or.null =
  472.   or
  473.     { key empty$
  474.     { booktitle empty$
  475.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  476.           crossref * warning$
  477.           ""
  478.         }
  479.         { "in {\em " booktitle * "\/}" * " \cite{" * crossref * "}" *}
  480.       if$
  481.     }
  482.     { "{\em in} \citeasnoun{" crossref * "}" * }
  483.       if$
  484.     }
  485.     { "{\em in} \citeasnoun{" crossref * "}" * }
  486.   if$
  487.   
  488. }
  489.  
  490. INTEGERS { len }
  491.  
  492. FUNCTION {chop.word}
  493. { 's :=
  494.   'len :=
  495.   s #1 len substring$ =
  496.     { s len #1 + global.max$ substring$ }
  497.     's
  498.   if$
  499. }
  500.  
  501. INTEGERS { ind tsslen }
  502.  
  503. STRINGS { tss ret rss istr }
  504.  
  505. FUNCTION {replace.substring}{
  506.   'rss :=
  507.   'tss :=
  508.   'istr :=
  509.   "" 'ret :=
  510.   tss text.length$ 'tsslen :=
  511.   #1 'ind :=
  512.     { istr ind tsslen substring$ "" = not }
  513.     { istr ind tsslen substring$ tss =
  514.         { ret rss * 'ret :=
  515.           ind tsslen + 'ind :=
  516.         }
  517.         { ret istr ind #1 substring$ * 'ret :=
  518.           ind #1 + 'ind :=
  519.         }
  520.       if$
  521.     }
  522.   while$
  523.   ret
  524. }
  525.  
  526. FUNCTION {format.lab.names.abbr}
  527. { 's :=
  528.   s num.names$ 'numnames :=
  529.   numnames #1 >
  530.     { numnames #2 >
  531.     { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  532.     { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  533.             { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  534.         { s #1 "{vv~}{ll}" format.name$ " \harvardand\ " *
  535.               s #2 "{vv~}{ll}" format.name$ * 
  536.             }
  537.           if$
  538.         }
  539.       if$
  540.     }
  541.     { s #1 "{vv~}{ll}" format.name$ }
  542.   if$
  543. }
  544.  
  545. FUNCTION {format.lab.names.full}
  546. { 's :=
  547.   #1 'nameptr :=
  548.   s num.names$ 'numnames :=
  549.   numnames 'namesleft :=
  550.     { namesleft #0 > }
  551.     { s nameptr "{vv~}{ll}" format.name$ 't :=
  552.       nameptr #1 >
  553.     { namesleft #1 >
  554.         { ", " * t * }
  555.         { t "others" =
  556.         { " et~al." * }
  557.         { " \harvardand\ " * t * }
  558.           if$
  559.         }
  560.       if$
  561.     }
  562.     't
  563.       if$
  564.       nameptr #1 + 'nameptr :=
  565.       namesleft #1 - 'namesleft :=
  566.     }
  567.   while$
  568. }
  569.  
  570. INTEGERS { author.field editor.field organization.field title.field key.field }
  571.  
  572. FUNCTION {init.field.constants}
  573. { #0 'author.field :=
  574.   #1 'editor.field :=
  575.   #2 'organization.field :=
  576.   #3 'title.field :=
  577.   #4 'key.field :=
  578. }
  579.  
  580. FUNCTION {make.list.label}
  581. { author.field field.used =
  582.     { format.authors }
  583.     { editor.field field.used =
  584.         { format.editors }
  585.         { organization.field field.used =
  586.             { "The " #4 organization chop.word #3 text.prefix$ }
  587.             { title.field field.used =
  588.                 { format.btitle }
  589.                 { key.field field.used =
  590.                     { key #3 text.prefix$ }
  591.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  592.                   if$
  593.                 }
  594.               if$
  595.             }
  596.           if$
  597.         }
  598.       if$
  599.     }
  600.   if$
  601. }
  602.  
  603. FUNCTION {make.full.label}
  604. { author.field field.used =
  605.     { author format.lab.names.full }
  606.     { editor.field field.used =
  607.         { editor format.lab.names.full }
  608.         { organization.field field.used =
  609.             { "The " #4 organization chop.word #3 text.prefix$ }
  610.             { title.field field.used =
  611.                 { format.btitle }
  612.                 { key.field field.used =
  613.                     { key #3 text.prefix$ }
  614.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  615.                   if$
  616.                 }
  617.               if$
  618.             }
  619.           if$
  620.         }
  621.       if$
  622.     }
  623.   if$
  624. }
  625.  
  626. FUNCTION {make.abbr.label} %%%XXX change
  627. {
  628.   etal.allowed
  629.     { author.field field.used =
  630.         { author format.lab.names.abbr }
  631.         { editor.field field.used =
  632.             { editor format.lab.names.abbr }
  633.             { organization.field field.used =
  634.                 { "The " #4 organization chop.word #3 text.prefix$ }
  635.                 { title.field field.used =
  636.                     { format.btitle }
  637.                     { key.field field.used =
  638.                         { key #3 text.prefix$ }
  639.                         {"Internal error :001 on " cite$ * " label" * warning$ }
  640.                       if$
  641.                     }
  642.                   if$
  643.                 }
  644.               if$
  645.             }
  646.           if$
  647.         }
  648.       if$
  649.     }
  650.     { make.full.label }
  651.   if$
  652. }
  653.  
  654. FUNCTION {output.bibitem}
  655. { newline$
  656.   "\harvarditem{" write$
  657.   make.abbr.label write$
  658.   "}{" write$
  659.   list.year write$
  660.   "}{" write$
  661.   cite$ write$
  662.   "}" write$
  663.   newline$
  664.   ""
  665.   before.all 'output.state :=
  666. }
  667.  
  668. FUNCTION {list.label.output}
  669. { make.list.label " " * write$
  670. }
  671.  
  672. FUNCTION {article}
  673. { output.bibitem
  674.   list.label.output
  675.   " " list.year * output.nonnull
  676.   author "author" item.check
  677.   crossref missing$
  678.     { journal emphasize "journal" duplicate$ item.check
  679.       pages empty$
  680.         {
  681.           output
  682.         }
  683.         {
  684.           " " *
  685.           format.vol.num.pages * output
  686.         }
  687.       if$
  688.     }
  689.     { format.article.crossref output.nonnull
  690.       format.pages output
  691.     }
  692.   if$
  693.   new.block
  694.   note output
  695.   fin.entry
  696. }
  697.  
  698. FUNCTION {book}
  699. { output.bibitem
  700.   list.label.output
  701.   " " list.year * output.nonnull
  702.   author empty$
  703.     { editor "author and editor" item.check }
  704.     { crossref missing$
  705.     { "author and editor" editor either.or.check }
  706.     'skip$
  707.       if$
  708.     }
  709.   if$
  710.   title.field field.used =
  711.     { skip$ }
  712.     { format.btitle "title" output.check }
  713.   if$
  714.   crossref missing$
  715.     { format.bvolume output
  716.       format.number.series output
  717.       format.edition output
  718.       publisher "publisher" output.check
  719.       address output
  720.     }
  721.     { format.book.crossref output.nonnull
  722.       format.edition output
  723.     }
  724.   if$
  725.   new.block
  726.   note output
  727.   fin.entry
  728. }
  729.  
  730. FUNCTION {booklet}
  731. { output.bibitem
  732.   list.label.output
  733.   " " list.year * output.nonnull
  734.   title.field field.used =
  735.     { skip$ }
  736.     { format.title quote "title" output.check }
  737.   if$
  738.   howpublished output
  739.   address output
  740.   new.block
  741.   note output
  742.   fin.entry
  743. }
  744.  
  745. FUNCTION {inbook}
  746. { output.bibitem
  747.   list.label.output
  748.   " " list.year * output.nonnull
  749.   author empty$
  750.     { editor "author and editor" item.check }
  751.     { crossref missing$
  752.     { "author and editor" editor either.or.check }
  753.     'skip$
  754.       if$
  755.     }
  756.   if$
  757.   crossref missing$
  758.     { format.bvolume output
  759.       format.number.series output
  760.       format.edition output
  761.       publisher "publisher" output.check
  762.       address output
  763.     }
  764.     { format.book.crossref output.nonnull
  765.       format.edition output
  766.     }
  767.   if$
  768.   format.chapter.pages "chapter and pages" output.check
  769.   new.block
  770.   note output
  771.   fin.entry
  772. }
  773.  
  774. FUNCTION {incollection}
  775. { output.bibitem
  776.   list.label.output
  777.   " " list.year * output.nonnull
  778.   author "author" item.check
  779.   crossref missing$
  780.     { format.in.ed.booktitle "booktitle" output.check
  781.       format.edition output
  782.       format.bvolume output
  783.       format.number.series output
  784.       publisher "publisher" output.check
  785.       address output
  786.     }
  787.     { format.incoll.inproc.crossref output.nonnull
  788.     }
  789.   if$
  790.   format.chapter.pages output
  791.   new.block
  792.   note output
  793.   fin.entry
  794. }
  795.  
  796. FUNCTION {inproceedings}
  797. { output.bibitem
  798.   list.label.output
  799.   " " list.year * output.nonnull
  800.   author "author" item.check
  801.   crossref missing$
  802.     { format.in.ed.booktitle "booktitle" output.check
  803.       format.bvolume output
  804.       format.number.series output
  805.       address empty$
  806.     { organization output
  807.       publisher output
  808.     }
  809.     { organization output
  810.       publisher output
  811.           address output.nonnull
  812.      }
  813.       if$
  814.     }
  815.     { format.incoll.inproc.crossref output.nonnull
  816.     }
  817.   if$
  818.   format.pages output
  819.   new.block
  820.   note output
  821.   fin.entry
  822. }
  823.  
  824. FUNCTION {conference} { inproceedings }
  825.  
  826. FUNCTION {manual}
  827. { output.bibitem
  828.   list.label.output
  829.   " " list.year * output.nonnull
  830.   title.field field.used =
  831.     { skip$ }
  832.     { format.btitle "title" output.check }
  833.   if$
  834.   format.edition output
  835.   author empty$
  836.     { organization empty$
  837.     { address output }
  838.     'skip$
  839.       if$
  840.     }
  841.     { organization output
  842.       address output
  843.     }
  844.   if$
  845.   new.block
  846.   note output
  847.   fin.entry
  848. }
  849.  
  850. FUNCTION {mastersthesis}
  851. { output.bibitem
  852.   list.label.output
  853.   " " list.year * output.nonnull
  854.   author "author" item.check
  855.   title.field field.used =
  856.     { skip$ }
  857.     { format.title "title" output.check }
  858.   if$
  859.   "Master's thesis" format.thesis.type output.nonnull
  860.   school "school" output.check
  861.   address output
  862.   new.block
  863.   note output
  864.   fin.entry
  865. }
  866.  
  867. FUNCTION {misc}
  868. { output.bibitem
  869.   list.label.output
  870.   " " list.year * output.nonnull
  871.   title.field field.used =
  872.     { skip$ }
  873.     { format.title quote output }
  874.   if$
  875.   howpublished output
  876.   new.block
  877.   note output
  878.   fin.entry
  879.   empty.misc.check
  880. }
  881.  
  882. FUNCTION {phdthesis}
  883. { output.bibitem
  884.   list.label.output
  885.   " " list.year * output.nonnull
  886.   author "author" item.check
  887.   title.field field.used =
  888.     { skip$ }
  889.     { title "title" output.check }
  890.   if$
  891.   "PhD thesis" format.thesis.type output.nonnull
  892.   school "school" output.check
  893.   address output
  894.   new.block
  895.   note output
  896.   fin.entry
  897. }
  898.  
  899. FUNCTION {proceedings}
  900. { output.bibitem
  901.   list.label.output
  902.   " " list.year * output.nonnull
  903.   format.bvolume output
  904.   format.number.series output
  905.   address empty$
  906.     { editor empty$
  907.     { skip$ }
  908.     { organization output
  909.     }
  910.       if$
  911.       publisher output
  912.     }
  913.     { editor empty$
  914.     'skip$
  915.     { organization output }
  916.       if$
  917.       publisher output
  918.       address output.nonnull
  919.     }
  920.   if$
  921.   new.block
  922.   note output
  923.   fin.entry
  924. }
  925.  
  926. FUNCTION {techreport}
  927. { output.bibitem
  928.   list.label.output
  929.   " " list.year * output.nonnull
  930.   author "author" item.check
  931.   title.field field.used =
  932.     { skip$ }
  933.     { format.title "title" output.check }
  934.   if$
  935.   format.tr.number output.nonnull
  936.   institution "institution" output.check
  937.   address output
  938.   new.block
  939.   note output
  940.   fin.entry
  941. }
  942.  
  943. FUNCTION {unpublished}
  944. { output.bibitem
  945.   list.label.output
  946.   " " list.year * output.nonnull
  947.   author "author" item.check
  948.   title.field field.used =
  949.     { skip$ }
  950.     { format.title "title" output.check }
  951.   if$
  952.   note "note" output.check
  953.   fin.entry
  954. }
  955.  
  956. FUNCTION {default.type} { misc }
  957.  
  958. MACRO {jan} {"January"}
  959.  
  960. MACRO {feb} {"February"}
  961.  
  962. MACRO {mar} {"March"}
  963.  
  964. MACRO {apr} {"April"}
  965.  
  966. MACRO {may} {"May"}
  967.  
  968. MACRO {jun} {"June"}
  969.  
  970. MACRO {jul} {"July"}
  971.  
  972. MACRO {aug} {"August"}
  973.  
  974. MACRO {sep} {"September"}
  975.  
  976. MACRO {oct} {"October"}
  977.  
  978. MACRO {nov} {"November"}
  979.  
  980. MACRO {dec} {"December"}
  981.  
  982. MACRO {acmcs} {"ACM Computing Surveys"}
  983.  
  984. MACRO {acta} {"Acta Informatica"}
  985.  
  986. MACRO {cacm} {"Communications of the ACM"}
  987.  
  988. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  989.  
  990. MACRO {ibmsj} {"IBM Systems Journal"}
  991.  
  992. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  993.  
  994. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  995.  
  996. MACRO {ieeetcad}
  997.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  998.  
  999. MACRO {ipl} {"Information Processing Letters"}
  1000.  
  1001. MACRO {jacm} {"Journal of the ACM"}
  1002.  
  1003. MACRO {jcss} {"Journal of Computer and System Sciences"}
  1004.  
  1005. MACRO {scp} {"Science of Computer Programming"}
  1006.  
  1007. MACRO {sicomp} {"SIAM Journal on Computing"}
  1008.  
  1009. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1010.  
  1011. MACRO {tods} {"ACM Transactions on Database Systems"}
  1012.  
  1013. MACRO {tog} {"ACM Transactions on Graphics"}
  1014.  
  1015. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1016.  
  1017. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1018.  
  1019. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1020.  
  1021. MACRO {tcs} {"Theoretical Computer Science"}
  1022.  
  1023. READ
  1024.  
  1025. EXECUTE {init.field.constants}
  1026.  
  1027. FUNCTION {sortify}
  1028. { purify$
  1029.   "l" change.case$
  1030. }
  1031.  
  1032. FUNCTION {sortify.names}
  1033. { " \harvardand\ " " " replace.substring
  1034.   " et~al." " zzz" replace.substring
  1035.   sortify
  1036. }
  1037.  
  1038. FUNCTION {author.key.label}
  1039. { author empty$
  1040.     { key empty$
  1041.     { title.field 'field.used := }
  1042.     { key.field 'field.used := }
  1043.       if$
  1044.     }
  1045.     { author.field 'field.used := }
  1046.   if$
  1047. }
  1048.  
  1049. FUNCTION {author.editor.key.label}
  1050. { author empty$
  1051.     { editor empty$
  1052.     { key empty$
  1053.         { title.field 'field.used := }
  1054.         { key.field 'field.used := }
  1055.       if$
  1056.       }
  1057.     { editor.field 'field.used := }
  1058.       if$
  1059.     }
  1060.     { author.field 'field.used := }
  1061.   if$
  1062. }
  1063.  
  1064. FUNCTION {author.key.organization.label}
  1065. { author empty$
  1066.     { key empty$
  1067.     { organization empty$
  1068.         { title.field 'field.used := }
  1069.         { organization.field 'field.used := }
  1070.       if$
  1071.     }
  1072.     { key.field 'field.used := }
  1073.       if$
  1074.     }
  1075.     { author.field 'field.used := }
  1076.   if$
  1077. }
  1078.  
  1079. FUNCTION {editor.key.organization.label}
  1080. { editor empty$
  1081.     { key empty$
  1082.     { organization empty$
  1083.         { title.field 'field.used := }
  1084.         { organization.field 'field.used := }
  1085.       if$
  1086.     }
  1087.     { key.field 'field.used := }
  1088.       if$
  1089.     }
  1090.     { editor.field 'field.used := }
  1091.   if$
  1092. }
  1093.  
  1094. FUNCTION {sort.format.title}
  1095. { 't :=
  1096.   "A " #2
  1097.     "An " #3
  1098.       "The " #4 t chop.word
  1099.     chop.word
  1100.   chop.word
  1101.   sortify
  1102.   #1 global.max$ substring$
  1103. }
  1104.  
  1105. FUNCTION {calc.label} %%%XXX change
  1106. { make.abbr.label
  1107.   title.field field.used =
  1108.     { sort.format.title }
  1109.     { sortify.names }
  1110.   if$
  1111.   year field.or.null purify$ #-1 #4 substring$ sortify
  1112.   *
  1113.   'sort.label :=
  1114. }
  1115.  
  1116. FUNCTION {preliminaries} %%%XXX change
  1117. { type$ "book" =
  1118.   type$ "inbook" =
  1119.   or
  1120.     'author.editor.key.label
  1121.     { type$ "proceedings" =
  1122.     'editor.key.organization.label
  1123.     { type$ "manual" =
  1124.         'author.key.organization.label
  1125.         'author.key.label
  1126.       if$
  1127.     }
  1128.       if$
  1129.     }
  1130.   if$
  1131.   author.field field.used = %%%XXX change
  1132.     {
  1133.       author num.names$ #2 >
  1134.         { #1 }
  1135.         { #0 }
  1136.       if$
  1137.       'etal.required :=
  1138.     }
  1139.     {
  1140.       editor.field field.used = 
  1141.         {
  1142.           editor num.names$ #2 >
  1143.             { #1 }
  1144.             { #0 }
  1145.           if$
  1146.         }
  1147.         { #0 }
  1148.       if$
  1149.       'etal.required :=
  1150.     }
  1151.   if$
  1152.   #1 'etal.allowed :=
  1153. }
  1154.  
  1155. FUNCTION {first.presort}
  1156. { calc.label
  1157.   sort.label
  1158.   title.field field.used =
  1159.     { skip$ }
  1160.     { "    "
  1161.       *
  1162.       make.list.label sortify.names
  1163.       *
  1164.       "    "
  1165.       *
  1166.       title field.or.null
  1167.       sort.format.title
  1168.       *
  1169.     }
  1170.   if$
  1171.   #1 entry.max$ substring$
  1172.   'sort.key$ :=
  1173. }
  1174.  
  1175. ITERATE {preliminaries}
  1176.  
  1177. ITERATE {first.presort}
  1178.  
  1179. SORT
  1180.  
  1181. STRINGS { last.sort.label next.extra last.full.label}
  1182.  
  1183. INTEGERS { last.extra.num last.etal.allowed}
  1184.  
  1185. FUNCTION {initialize.confusion}
  1186. { #0 int.to.chr$ 'last.sort.label :=
  1187.   #0 int.to.chr$ 'last.full.label :=
  1188.   #1 'last.etal.allowed :=
  1189. }
  1190.  
  1191. FUNCTION {confusion.pass}
  1192. { last.sort.label sort.label =
  1193.     { last.etal.allowed 
  1194.         { last.full.label make.full.label sortify.names =
  1195.             { skip$ }
  1196.             { #0 'etal.allowed :=
  1197.               #0 'last.etal.allowed :=
  1198.             }
  1199.           if$
  1200.         }
  1201.         { #0 'etal.allowed := }
  1202.       if$
  1203.     }
  1204.     { sort.label 'last.sort.label :=
  1205.       make.full.label sortify.names 'last.full.label :=
  1206.       #1 'last.etal.allowed :=
  1207.     }
  1208.   if$
  1209. }
  1210.  
  1211. EXECUTE {initialize.confusion}
  1212.  
  1213. ITERATE {confusion.pass}
  1214.  
  1215. EXECUTE {initialize.confusion}
  1216.  
  1217. REVERSE {confusion.pass}
  1218.  
  1219. FUNCTION {initialize.last.extra.num}
  1220. { #0 int.to.chr$ 'last.sort.label :=
  1221.   "" 'next.extra :=
  1222.   #0 'last.extra.num :=
  1223. }
  1224.  
  1225. FUNCTION {forward.pass}
  1226. { last.sort.label sort.label =
  1227.     { last.extra.num #1 + 'last.extra.num :=
  1228.       last.extra.num int.to.chr$ 'extra.label :=
  1229.     }
  1230.     { "a" chr.to.int$ 'last.extra.num :=
  1231.       "" 'extra.label :=
  1232.       sort.label 'last.sort.label :=
  1233.     }
  1234.   if$
  1235. }
  1236.  
  1237. FUNCTION {reverse.pass}
  1238. { next.extra "b" =
  1239.     { "a" 'extra.label := }
  1240.     'skip$
  1241.   if$
  1242.   year empty$
  1243.     { "n.d." extra.label emphasize * 'list.year := }
  1244.     { year extra.label emphasize * 'list.year := }
  1245.   if$
  1246.   extra.label 'next.extra :=
  1247. }
  1248.  
  1249. ITERATE {first.presort}
  1250.  
  1251. SORT
  1252.  
  1253. EXECUTE {initialize.last.extra.num}
  1254.  
  1255. ITERATE {forward.pass}
  1256.  
  1257. REVERSE {reverse.pass}
  1258.  
  1259. FUNCTION {second.presort}
  1260. { make.list.label
  1261.   title.field field.used =
  1262.     { sort.format.title }
  1263.     { sortify.names }
  1264.   if$
  1265.   "    "
  1266.   *
  1267.   list.year field.or.null sortify
  1268.   *
  1269.   "    "
  1270.   *
  1271.   title.field field.used =
  1272.     { skip$ }
  1273.     { title field.or.null
  1274.       sort.format.title
  1275.       *
  1276.     }
  1277.   if$
  1278.   #1 entry.max$ substring$
  1279.   'sort.key$ :=
  1280. }
  1281.  
  1282. ITERATE {second.presort}
  1283.  
  1284. SORT
  1285.  
  1286. FUNCTION {begin.bib}
  1287. { preamble$ empty$
  1288.     'skip$
  1289.     { preamble$ write$ newline$ }
  1290.   if$
  1291.   "\begin{thebibliography}{xx}" write$ newline$
  1292. }
  1293.  
  1294. EXECUTE {begin.bib}
  1295.  
  1296. EXECUTE {init.state.consts}
  1297.  
  1298. ITERATE {call.type$}
  1299.  
  1300. FUNCTION {end.bib}
  1301. { newline$
  1302.   "\end{thebibliography}" write$ newline$
  1303. }
  1304.  
  1305. EXECUTE {end.bib}
  1306.